﻿@using AP.Framework.Utilities.MvcPager;
@model PagedList<AP.Web.Areas.Admin.Models.ArticleModels>
@{
    ViewBag.Title = "文章列表";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<ul class="breadcrumb" style="padding-left: 0px; margin-bottom: 10px;">
    <li><a href="@Url.Action("Index", "Default", "Admin")">首页</a> <span class="divider">
        /</span></li>
    <li><a class="active">@ViewBag.Title</a></li>
</ul>
<p>
    <a href="@Url.Action("Add", "Article", "Admin")" class="btn btn-primary">添 加</a></p>
<div id="grid">
    @{  var grid = new WebGrid(source: Model, defaultSort: "ID", canPage: false, ajaxUpdateContainerId: "grid");    
        @grid.GetHtml(
                               tableStyle: "table table-bordered",
                               headerStyle: "header",
                               alternatingRowStyle: "alt",
                               footerStyle: "foot",
                                columns: grid.Columns(
                                            grid.Column("Title", "标题"),
                                            grid.Column("Author", "作者"),
                                            grid.Column("ChannelName", "频道"),
                                            grid.Column("CategoryName", "分类"),
                                            grid.Column("Sequence", "顺序"),
                                            grid.Column("IsDisable", "是否隐藏/锁定"),
                                            grid.Column("ModifyBy", "创建者"),
                                             grid.Column("ModifyTime", "时间", format: (item) => item.ModifyTime == null ? "" : item.ModifyTime.ToString("yyyy-MM-dd")),
                                            grid.Column(format: (item) => Html.ActionLink("编辑", "Edit", new { articleId = item.ID }, new { @class = "badge badge-important" })),
                                            grid.Column(format: (item) => Html.ActionLink("删除", "Delete", new { articleId = item.ID }, new { @class = "badge badge-important" }))
                                            ),
                                             fillEmptyRows: !IsPost

                                                        ) 
    }
    <div class="paging-bar">
        @Html.Pager(Model, new PagerOptions { PageIndexParameterName = "page" })
    </div>
</div>
